<div id="basic-modal-content">
	<img src="<?php echo $user_setting->photo_path ;?>" width="120" height="90" class="avatar" style=" 50% 50% no-repeat" alt="<?php echo $this->session->userdata('user_name');?>的头像">
	加 &nbsp;&nbsp;<?php echo strlen($user_setting->n_name)!=0?$user_setting->n_name:$user->user_name;?> &nbsp;&nbsp;为好友，附言:
	
	<input type="text" id="add_comment" size='30' maxlength='50' style="width:300px"></input>
	<br>
	<div id="form-btns">
	<a class="form-btn" href="javascript:add_friend();" id="sub_cal">确定</a>
	<a class="form-btn" href="javascript:cancel_add();">取消</a>
	</div>
	<input type="hidden" id="user_data" value="<?php echo $user->user_id;?>"/>
	
		
</div>


<script type="text/javascript">
	//关闭弹出框
	function cancel_add(){
		$.modal.close();
	}

	var xmlHttp_add;
	function add_friend(){
		var fuid=$("#user_data").val();
		var note=$("#add_comment").val();
		xmlHttp_add=GetXmlHttpObject();
		send_friend_post_data(fuid,note);
	}

	function send_friend_post_data(fuid,note){
		if (xmlHttp_add==null)
		  {
		  	alert ("Browser does not support HTTP Request");
		  	return;
		  }
		 var url="friend/add_friend";
		 xmlHttp_add.onreadystatechange=friendstateChanged;
		 xmlHttp_add.open("POST",url,true);
		 xmlHttp_add.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=utf-8");
		 xmlHttp_add.send("fuid="+fuid+"&note="+note);
	}

	function friendstateChanged() 
	  { 
		alert(xmlHttp_add.responseText);
	  	if (xmlHttp_add.readyState==4 || xmlHttp_add.readyState=="complete")
	 	  {   	
	 			$.modal.close();
	 			if(xmlHttp_add.responseText == '请求已发送，等待对方验证中'){
		 			$("#add_block").hide()
	 			}
	   	 		flash_success_message(xmlHttp_add.responseText);
	   	 		 
	   	} 
	  }
	
</script>